package classroom1.five;

import classroom1.five2.Pupil;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:周次煜
 * Date: 2024-04-19
 * Time：10:55
 */

public class  Student {
    private   String name;
    private int age;
    private char sex;
    private  double score;

    public Student(String name, int age, char sex, double score) {
        this.name = name;
        this.age = age;
        this.sex = sex;
        this.score = score;
    }

//    public void setName(String name) {
//        this.name = name;
//    }

    public void setAge(int age) {
        this.age = age;
    }

    public void setSex(char sex) {
        this.sex = sex;
    }

    public void setScore(double score) {
        this.score = score;
    }

    public String getName() {
        return name;
    }

    public int getAge() {
        return age;
    }

    public char getSex() {
        return sex;
    }

    public double getScore() {
        return score;
    }



    void eat() {
        System.out.println(this.getName()+"正在干饭!");
    }

    private void sleep() {
        System.out.println(this.getName()+"正在睡觉！");
    }

    protected void  study() {
        System.out.println(this.getName()+"正在学习！");
    }
}


class Test{

    public static void main(String[] args) {
        Student student1=new Student("小远",19,'男',130);
        student1.setScore(149);
        System.out.println(student1.getName()+"的年龄为："+student1.getAge()+" 性别为： "+student1.getSex()+" 平时成绩为： "+student1.getScore());


        Student student2=new Pupil("小杨哥",17,'男',119);
        student2.eat();
        student2.study();


        if (student2 instanceof Pupil) {
            System.out.println("Pupil 是 Student 子类！");
        } else  {
            System.out.println("Pupil 不是 Student 子类！");

        }
    }



}